﻿/**	@file		iris_msg.h
 *	@date		(2008-09-28 13:55:28)/(2010-02-13 15:56:05)
 *-----------------------------------------------------------------------------
 *	@version	1.1.1.1
 *	@author		Nick Shallery	(nicknide@gmail.com)
 *	@copyright	YOU HAVE ALL LEFT WITH THIS CODE WHILE YOU KEEP COMMENT IN EVERY COPY.
 *-----------------------------------------------------------------------------
**/

#if			!defined(__LOLIX_LXIRIS__IRIS_MSG__H__NICK__K_IN_G__)
#define		__LOLIX_LXIRIS__IRIS_MSG__H__NICK__K_IN_G__
//==============================================================================
//--------------------------------------------------------------------------

#if			!defined(__LOLIX__LOLI_X_MACRO__K_IN_G__)
	#include	"../../lolix/lolix_macro.h"
#endif	//	!defined(__LOLIX__LOLI_X_MACRO__K_IN_G__)

#if			!defined(__LOLIX__LOLIX_TYPE__K_IN_G__)
	#include	"../../lolix/lolix_type.h"
#endif	//	!defined(__LOLIX__LOLIX_TYPE__K_IN_G__)

#if			!defined(__LOLIX__TOY__L_X_ASSERT_NICK__K_IN_G__)
	#include	"../../lolix/toy/lx_assert.h"
#endif	//	!defined(__LOLIX__TOY__L_X_ASSERT_NICK__K_IN_G__)

namespace lxiris{

enum ENUM_MSG_TYPE
{	MSG_TYPE_MOUSE_MOVE
,	MSG_TYPE_MOUSE_STATUS
,	MSG_TYPE_MOUSE_ZONE
,	MSG_TYPE_KEY_STATUS
,	MSG_TYPE_IRIS_RESIZE
};

struct	SMsgTypeMouseMove
{
	static const ENUM_MSG_TYPE MSG_TYPE = MSG_TYPE_MOUSE_MOVE;
	float x;	// 4096
	float y;	// 4096
	union
	{
		lolix::lx_u32 btn_mask;
		struct
		{
			lolix::lx_u32 left	: 1;	//
			lolix::lx_u32 right	: 1;	//
			lolix::lx_u32 middle: 1;	//
			lolix::lx_u32 btn_3	: 1;	//
			lolix::lx_u32 btn_4	: 1;	//
			lolix::lx_u32 btn_5	: 1;	//
			lolix::lx_u32 btn_6	: 1;	//
			lolix::lx_u32 btn_7	: 1;	//
		}bits;
	}flag;
};
STATIC_ASSERT(sizeof SMsgTypeMouseMove == 12);
struct	SMsgTypeMouseStatus
{
	static const ENUM_MSG_TYPE MSG_TYPE = MSG_TYPE_MOUSE_STATUS;
	enum ENUM_ACTION_TYPE{ACTION_TYPE_BTN_DOWN, ACTION_TYPE_BTN_UP, ACTION_TYPE_BTN_CANCEL};
	float			x;
	float			y;
	lolix::lx_u32	btn		: 3;	//	0~8
	lolix::lx_u32	action	: 2;	//	0. 按键按下; 1. 按键弹起; 2. 按键取消
};
STATIC_ASSERT(sizeof SMsgTypeMouseStatus == 12);
struct	SMsgTypeMouseZone
{
	static const ENUM_MSG_TYPE MSG_TYPE = MSG_TYPE_MOUSE_ZONE;
	float	x;
	float	y;
	union
	{
		lolix::lx_u32	zone_type;
		struct
		{
			lolix::lx_u32	enter	: 1;
			lolix::lx_u32	leave	: 1;
			lolix::lx_u32	efocus	: 1;
			lolix::lx_u32	lfocus	: 1;
		};
	};
};
STATIC_ASSERT(sizeof SMsgTypeMouseZone == 12);
struct	SMsgTypeKeyStatus
{
	static const ENUM_MSG_TYPE MSG_TYPE = MSG_TYPE_KEY_STATUS;
	lolix::lx_u32	btn		: 8;
	lolix::lx_u32	down	: 1;	//	按键按下
	lolix::lx_u32	click	: 1;	//	点击
	lolix::lx_u32	up		: 1;	//	按键弹起
	lolix::lx_u32	cancel	: 1;	//	按键取消
};
STATIC_ASSERT(sizeof SMsgTypeKeyStatus == 4);
struct	SMsgTypeIrisResize
{
	static const ENUM_MSG_TYPE MSG_TYPE = MSG_TYPE_IRIS_RESIZE;
	lolix::lx_u32	w : 16;
	lolix::lx_u32	h : 16;
};
STATIC_ASSERT(sizeof SMsgTypeIrisResize == 4);

}


//--------------------------------------------------------------------------
//==============================================================================
#endif	//	!defined(__LOLIX_LXIRIS__IRIS_MSG__H__NICK__K_IN_G__)
